<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
function ediplan(id)
{
	$("#cat_id").val(id);
	
	
	
  $('#returndataModal').modal('show');

}

function addattribute()
{
	$('#addattributeform').modal('show');	
}
function getdev()
{
	var developer = $("#developer").val();
	var attr_name = $("#attr_name").val();
	if(attr_name=="")
	{
		$("#attr_name").val(developer);	
	}else{
		var namedevl = attr_name +","+developer;
		$("#attr_name").val(namedevl);
	}
	
}
function delexternaluser(id,is_top)
{
	$.post("/management/ajaxbutton", {"op": "delexternaluser","id":id,"is_top":is_top},
	  function(data){
			if(data)
			{
				
			}
			
		return;
	   },"json");	
}
function opengoods(id,is_open)
{
	$.post("/management/ajaxbutton", {"op": "opengoods","id":id,"is_open":is_open},
	  function(data){
			if(data)
			{
				
			}
			
		return;
	   },"json");		
}
/**
 * 点击类型按钮时切换选项的禁用状态
 */
function radioClicked(n)
{
  document.forms['saveattform'].elements["attr_values"].disabled = n > 0 ? false : true;
}
</script>
<title>商品类型</title>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">外部组员</h1>
      <span class="pagedesc">
      1、添加成员时，必须是部门设置中的外部组成员<br>
    &nbsp;&nbsp;&nbsp;&nbsp;  2、同外部组成员，可以看到组员添加的商品，订单、报表，发货计划<br>
    &nbsp;&nbsp;&nbsp;&nbsp;  3、停用状态，组成员不允许登录。<br>
    &nbsp;&nbsp;&nbsp;&nbsp;  4、红色可查看所有SKU 表示 除自己组创建的之外，还允许查看公司除外部其他组创建之外的其他SKU。
      
      </span>
      <div class="menulist">
        <ul class="profile_summary">
          <li> <a href="javascript:void(0)" onClick="addattribute()" class=""><span>添加外部组员关系</span></a></li>
        </ul>
      </div>
     
      <div class="menulist">
        <ul class="profile_summary">
          <li class="current"></li>
        </ul>
      </div>
    </div>
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
        <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
          <thead>
            <tr>
              <th class="head1">名称</th>
              <th class="head1">成员</th>
              <th class="head1">状态</th>
              <th class="head1">商品名</th>
            </tr>
          </thead>
          <tbody>
          
          {{foreach from=$list item=li key=key}}
          <tr>
            <td class="head1">{{$li.external_name}}</td>
             <td class="head1">{{$li.external_user}}</td>
              <td class="head1">{{if $li.is_stop==1}}停止{{else}}启用{{/if}}</td>
            <td class="head0"><a href="javascript:void(0)" onClick="ediplan({{$li.id}})"> 添加成员</a>｜<a href="javascript:void(0)" onClick="delexternaluser({{$li.id}},{{$li.is_stop}})">移除</a>｜<a href="javascript:void(0)" onClick="opengoods({{$li.id}},{{$li.is_opengoods}})">
            {{if $li.is_opengoods ==1}}
            	<font color="#FF0000">可查看所有SKU</font>
            {{else}}
            	查看所有SKU
            {{/if}}
            </a></td>
          </tr>
          {{/foreach}}
            </tbody>
          
        </table>
        <br />
      </div>
      <!--subcontent--> 
      
      <!--subcontent--> 
      
    </div>
    <!--contentwrapper--> 
    
  </div>
  <!-- centercontent --> 
  
</div>

<!-- 模态框（Modal） -->
<form action="/management/ajaxbutton?op=saveexternaluser"  method="post" name="saveattform" id="saveattform"  enctype="multipart/form-data" >
<input type="hidden" name="cat_id" id="cat_id">
<input type="hidden" name="attr_id" id="attr_id">
  <div class="modal fade" id="returndataModal" tabindex="-1" role="dialog" aria-labelledby="returnModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="returnModalLabel"> 添加成员 </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <th width="150"><label>成员</label> </th>
              <td align="left"><input type="text" name="attr_name" id="attr_name" class="_check width400"></td>
            </tr>
             <tr>
              <th><label>外部员工名称</label> </th>
              <td align="left"> 
          <select name="developer" id="developer" class="selection " style="width:100px;" onChange="getdev()" >
            <option value="0">请选择</option>
            {{foreach from=$userlist item=res key=key}}
            <option value="{{$res.name}}" {{if $developer eq $res}} selected{{/if}}>{{$res.name}}</option>
            {{/foreach}}
        </select> </td>
            </tr>
            
          </table>
           <div id="showlist"></div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmit('saveattform','returndataModal')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
</form>

<!-- 模态框（Modal）添加商品属性 -->
<form action="/management/ajaxbutton?op=saveattribute"  method="post" name="attributeform" id="attributeform" >
  <div class="modal fade" id="addattributeform" tabindex="-1" role="dialog" aria-labelledby="returnaddattributeform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="returnaddattributeform"> 添加组 </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>组名称： </td>
              <td align="left"><input type="text" name="name" id="name" required class="width200" value="{{$other}}" placeholder="组名称：亚马逊一组" /></td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmit('attributeform','addattributeform')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
</form>
</body>
</html>